(function() {
    XT.namespace("IC");
    var d = YAHOO.util,b = YAHOO.lang,c = YAHOO.env.ua,a = d.Anim,h = d.Connect,g = d.Dom,f = d.Event;
    var e = function(k) {
        for (var j = k.childNodes.length - 1; 0 <= j; j--) {
            k.removeChild(k.childNodes[j])
        }
    };
    XT.IC.SearchCate = function() {
        var k = null,n = {},o = false,m = {},j = {};
        var p = function(s) {
            e(j.lstSearchResult);
            var t = document.createElement("span");
            t.appendChild(document.createTextNode(s));
            var r = document.createElement("li");
            r.className = "status";
            r.appendChild(t);
            j.lstSearchResult.appendChild(r)
        };
        var q = function(s, u, v) {
            e(j.spanResultTips);
            var r = document.createDocumentFragment();
            if (true === v) {
                var t = document.createElement("em");
                t.className = "warn";
                t.appendChild(document.createTextNode("\u8be5\u76ee\u5f55\u4e0b\u60a8\u4ec5\u80fd\u53d1\u5e03\u4e8c\u624b\u548c\u95f2\u7f6e\u5546\u54c1\uff01"));
                r.appendChild(t)
            }
            if (0 !== s) {
                r.appendChild(document.createTextNode("\u60a8\u5f53\u524d\u6240\u9009\u62e9\u7684\u7c7b\u76ee\u4e0b\u5171\u6709 "));
                var t = document.createElement("em");
                t.className = "num";
                t.appendChild(document.createTextNode(s));
                r.appendChild(t);
                r.appendChild(document.createTextNode(" \u4ef6\u5173\u952e\u5b57\u4e3a\u201c"));
                var t = document.createElement("em");
                t.className = "key";
                t.appendChild(document.createTextNode(u));
                r.appendChild(t);
                r.appendChild(document.createTextNode("\u201d\u7684\u5b9d\u8d1d"))
            }
            j.spanResultTips.appendChild(r)
        };
        var l = function(r) {
            alert(r);
            return false
        };
        var i = function() {
            var r = j.iptCateSearch.value.replace(/^[\s\t ]+/g, "");
            if ("" === r) {
                return l("\u5173\u952e\u5b57\u4e0d\u80fd\u4e3a\u7a7a")
            } else {
                var s = "keyword=" + encodeURIComponent(r)
            }
            if (null !== k && true === h.isCallInProgress(k)) {
                return l("\u641c\u7d22\u6b63\u5728\u8fdb\u884c\u4e2d")
            }
            XT.IC.CateSetup.switchMode(0);
            g.removeClass(j.divLoading, "transparent");
            g.addClass(j.divResultTips, "hidden");
            k = h.asyncRequest("POST", j.apiSearchUrl + ((-1 === j.apiSearchUrl.indexOf("?")) ? "?" : "&") + "_input_charset=utf-8", {success:function(u) {
                g.addClass(j.divLoading, "transparent");
                if (-1 === u.status) {
                    return p("\u641c\u7d22\u8fde\u63a5\u8d85\u65f6\uff0c\u8bf7\u91cd\u8bd5\u3002")
                } else {
                    if (undefined !== u.responseText) {
                        try {
                            var A = b.JSON.parse(u.responseText)
                        } catch(G) {
                            return p("\u641c\u7d22\u7ed3\u679c\u683c\u5f0f\u9519\u8bef\uff0c\u8bf7\u91cd\u8bd5\u3002")
                        }
                        if (0 === A.num) {
                            p("\u62b1\u6b49\uff0c\u6ca1\u6709\u627e\u5230\u4e0e\u5173\u952e\u5b57\u201c" + r + "\u201d\u76f8\u5173\u7684\u7c7b\u76ee\u3002")
                        } else {
                            e(j.lstSearchResult);
                            n = {elmt:null,sid:0,leaf:0};
                            var t = document.createDocumentFragment(),C = A.data,H = A.type;
                            if (1 === H) {
                                var F = new RegExp("(" + r + ")", "i"),B = document.createElement("em");
                                B.appendChild(document.createTextNode(r))
                            }
                            for (var v in C) {
                                var J = A.data[v],y = J.path.length;
                                var I = document.createElement("ol");
                                I.className = "category-path";
                                for (var E = 0; E < y; E++) {
                                    var K = document.createElement("li");
                                    var x = document.createDocumentFragment();
                                    if (1 === H && F.test(J.path[E])) {
                                        var z = J.path[E].split(r),M = z.length;
                                        for (var D = 0; D < M; D++) {
                                            if (D !== 0) {
                                                x.appendChild(B.cloneNode(true))
                                            }
                                            x.appendChild(document.createTextNode(z[D]))
                                        }
                                    } else {
                                        x.appendChild(document.createTextNode(J.path[E]))
                                    }
                                    K.appendChild(x);
                                    I.appendChild(K)
                                }
                                I.firstChild.className = "root";
                                var L = 1;
                                if (1 === H) {
                                    L = parseInt(J.leaf, 10);
                                    if (0 === L) {
                                        K = document.createElement("li");
                                        K.appendChild(document.createTextNode("..."));
                                        I.appendChild(K)
                                    }
                                } else {
                                    var w = document.createElement("span");
                                    w.appendChild(document.createTextNode("(" + J.count + ")"));
                                    K.appendChild(w)
                                }
                                K = document.createElement("li");
                                K.className = "item";
                                K.appendChild(I);
                                t.appendChild(K);
                                (function() {
                                    var R = K,P = J.sid,Q = L,O = J.count || 0,N = (false === o && "undefined" !== typeof m[P]);
                                    f.on(R, "dblclick", function(S) {
                                        if (0 != c.opera) {
                                            f.stopEvent(S)
                                        }
                                        XT.IC.CateSetup.submitForm(0)
                                    });
                                    f.on(R, "click", function(S) {
                                        if (n.sid === P) {
                                            return false
                                        }
                                        g.addClass(R, "selected");
                                        g.removeClass(n.elmt, "selected");
                                        var U = -1 !== Array.indexOf(j.valRestrictedCates, P);
                                        var T = 0;
                                        if (false === U) {
                                            if (2 === Q) {
                                                T = 3
                                            } else {
                                                T = 1
                                            }
                                        } else {
                                            T = 2
                                        }
                                        XT.IC.CateSetup.updateTriggers(T);
                                        if (true === U) {
                                            g.removeClass(j.divRestrictedTip, "transparent")
                                        } else {
                                            g.addClass(j.divRestrictedTip, "transparent")
                                        }
                                        if (0 === H || true === N) {
                                            g.removeClass(j.divResultTips, "hidden");
                                            q(O, r, N)
                                        } else {
                                            g.addClass(j.divResultTips, "hidden")
                                        }
                                        n.elmt = R;
                                        n.sid = P;
                                        n.leaf = Q
                                    })
                                })()
                            }
                            j.lstSearchResult.appendChild(t)
                        }
                    } else {
                        return p("\u641c\u7d22\u6570\u636e\u4e22\u5931\uff0c\u8bf7\u91cd\u8bd5\u3002")
                    }
                }
            },failure:function() {
                g.addClass(j.divLoading, "transparent");
                return p("\u63a5\u53e3\u8bbf\u95ee\u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002")
            },timeout:10000,cache:false}, s)
        };
        return{init:function() {
            j = XT.IC.CateSetup.getConfig();
            if ("undefined" === typeof j) {
                return false
            }
            if (1 === XT.IC.AlchlCates.allow) {
                o = true
            } else {
                m = XT.IC.AlchlCates.data
            }
            f.on(j.frmCateSearch, "submit", function(r) {
                f.stopEvent(r);
                i()
            });
            f.on(j.linkCancel, "click", function(r) {
                f.stopEvent(r);
                g.addClass(j.divLoading, "transparent");
                XT.IC.CateSetup.switchMode(1)
            })
        },getSelCate:function() {
            return n
        }}
    }();
    XT.IC.OftenSelected = function() {
        var j = {};
        var k = function(l) {
            alert(l);
            return false
        };
        var i = function() {
            var q = j.selOftenSelected,o = q.getElementsByTagName("option")[0],p = XT.IC.OftenSelCates.data,n = document.createDocumentFragment();
            o.replaceChild(document.createTextNode("\u8bf7\u9009\u62e9"), o.firstChild);
            for (var m in p) {
                var l = document.createElement("option");
                l.setAttribute("value", m);
                l.appendChild(document.createTextNode(p[m]));
                n.appendChild(l)
            }
            q.appendChild(n);
            f.on(q, "change", function(s) {
                var r = q.options[q.selectedIndex].value;
                if (0 !== r) {
                    XT.IC.CateSetup.switchMode(1);
                    XT.IC.Cascading.getBranch(r)
                }
            })
        };
        return{init:function() {
            j = XT.IC.CateSetup.getConfig();
            if ("undefined" === typeof j) {
                return false
            }
            i()
        }}
    }();
    XT.IC.Cascading = function() {
        var l = null,m = null,q = null,o = 1,n = 0,y = [],w = {},j = false,r = "",u = 0,A = {};
        var s = function(B) {
            alert(B);
            return false
        };

        var p = function(B) { //change CateDesc
            if ("undefined" === typeof w[B]) {
                g.addClass(A.divCateDesc, "hidden")
            } else {
                g.removeClass(A.divCateDesc, "hidden");
                A.emCateDesc.replaceChild(document.createTextNode(w[B]), A.emCateDesc.firstChild)
            }
        };
        //chanage y ->  elmt,sid,type:type,leaf
        var x = function(C, B) {
            if (y.length > C) {
                y.splice(C, y.length - C)
            }
            y.push(B)
        };
        
        var k = function(E, C) {// move cate into view
            if (true === C) {
                var B = {left:{by:E}}
            } else {
                if (null !== m && true === m.isAnimated()) {
                    m.stop()
                }
                var B = {left:{to:E}}
            }
            m = new a(A.olCascadingList, B, 0.5, d.Easing.easeOutStrong);
            if (0 != c.gecko) {
                var D = A.olCascadingList.getElementsByTagName("ul");
                m.onStart.subscribe(function() {
                    for (var F = D.length - 1; 0 <= F; F--) {
                        D[F].className = "no-scroll"
                    }
                });
                m.onComplete.subscribe(function() {
                    for (var F = D.length - 1; 0 <= F; F--) {
                        D[F].className = ""
                    }
                })
            }
            m.animate()
        };
        //catePath
        var i = function(B, D, C, H) {
            if (y.length >= B) {
                var I = A.olCatePath.childNodes;
                for (var F = I.length - 1; B <= F; F--) {
                    A.olCatePath.removeChild(I[F])
                }
            }
            var J = document.createElement("a");
            J.setAttribute("href", "#");
            J.appendChild(document.createTextNode(C));
            var E = document.createElement("li");
            if (0 === B) {
                E.className = "root"
            }
            E.appendChild(J);
            var G = document.createDocumentFragment();
            G.appendChild(E);
            if (1 !== H) {
                var E = document.createElement("li");
                E.appendChild(document.createTextNode("..."));
                G.appendChild(E)
            }
            A.olCatePath.appendChild(G);
            y[B].tipXY = [g.getX(J),g.getY(J) - 35];
            f.on(J, "click", function(K) {
                f.stopEvent(K);
                if (0 < n && 4 > B) {
                    k(0);
                    o = 1;
                    n = 0;
                    if (0 === n) {
                        g.addClass(A.linkPrev, "transparent")
                    }
                    g.removeClass(A.linkNext, "transparent")
                } else {
                    if (B - 3 !== n && 3 < B) {
                        var L = (B - 3) * A.valListWidth * -1 + A.valAdjustWidth;
                        k(L);
                        o++;
                        n = B - 3;
                        g.removeClass(A.linkPrev, "transparent");
                        if (A.olCascadingList.childNodes.length - 4 === n) {
                            g.addClass(A.linkNext, "transparent")
                        } else {
                            g.removeClass(A.linkNext, "transparent")
                        }
                    }
                }
            });
            f.on(J, "mouseover", function(K) {
                g.removeClass(A.divTooltip, "transparent");
                g.setXY(A.divTooltip, y[B].tipXY)
            });
            f.on(J, "mouseout", function(K) {
                g.addClass(A.divTooltip, "transparent")
            })
        };
        //make List
        var v = function(H, G) {
            var G = G || "0",I = y.length,K = H.data;
            var N = document.createElement("ul"),F = document.createElement("li");
            F.className = "title";
            F.appendChild(document.createTextNode((I + 1) + " \u7ea7\u7c7b\u76ee"));
            N.appendChild(F);
            for (var E in K) {
                if (false === j && r === E) {
                    continue
                }
                var O = K[E],J = parseInt(O.leaf, 10),F = document.createElement("li");
                if (1 !== J) {
                    F.className = "parent"
                }
                var B = document.createElement("span");
                B.appendChild(document.createTextNode(O.name));
                B.setAttribute("data-spell", O.spell);
                F.appendChild(B);
                if ("0" !== G && E === G) {
                    g.addClass(F, "selected");
                    x(I, {elmt:F,sid:E,type:H.type,leaf:J});
                    i(I, E, O.name, J)
                }
                N.appendChild(F);
                (function() {
                    var T = F,R = E,P = O.name,Q = H.type,S = J;
                    f.on(T, "click", function(ac) {
                        if ("undefined" !== typeof y[I] && y[I].sid === R) {
                            return false
                        }
                        g.addClass(this, "selected");
                        if ("undefined" !== typeof y[I]/* && y[I].sid !== R*/) {
                            g.removeClass(y[I].elmt, "selected")
                        }
                        var X = -1 !== Array.indexOf(A.valRestrictedCates, R);
                        var aa = 0;
                        if (0 === I && true === X) {
                            aa = 2
                        } else {
                            if (0 === Q && 0 !== S) {
                                if (1 === S) {
                                    aa = 1
                                } else {
                                    aa = 3
                                }
                            } else {
                                if (1 === Q) {
                                    aa = 3
                                }
                            }
                        }
                        XT.IC.CateSetup.updateTriggers(aa);
                        if (true === X) {
                            g.removeClass(A.divRestrictedTip, "transparent")
                        } else {
                            g.addClass(A.divRestrictedTip, "transparent")
                        }
                        x(I, {elmt:this,sid:R,type:Q,leaf:S});//chanage y
                        p(R);//change CateDesc
                        i(I, R, P, S);//catePath
                        var ab = A.olCascadingList.childNodes,W = ab.length;
                        if (y.length < W) {
                            for (var Y = ab.length - 1; I < Y; Y--) {
                                A.olCascadingList.removeChild(ab[Y])
                            }
                            if (1 === S) {
                                var Z = ab.length;
                                if (4 < W && 5 > Z) {
                                    k(0);
                                    o = 1;
                                    n = 0;
                                    g.addClass(A.linkPrev, "transparent");
                                    g.addClass(A.linkNext, "transparent")
                                } else {
                                    if (4 < Z) {
                                        var ae = (Z - 4) * A.valListWidth * -1 + A.valAdjustWidth;
                                        k(ae);
                                        o = 1;
                                        n = Z - 4;
                                        g.removeClass(A.linkPrev, "transparent");
                                        g.addClass(A.linkNext, "transparent")
                                    }
                                }
                            }
                        }
                        if (1 !== S) {
                            if (1 === Q) {
                                var V = [];
                                for (var Y = y.length - 1; 0 <= Y; Y--) {
                                    var U = y[Y];
                                    if (1 === U.type) {
                                        V.unshift(U.sid)
                                    } else {
                                        if (0 !== U.leaf) {
                                            var ad = U.sid;
                                            break
                                        }
                                    }
                                }
                                t(ad, V.join(";"), true)
                            } else {
                                t(R, "", true)
                            }
                        }
                    })
                })()
            }
            var F = document.createElement("li");
            F.appendChild(N);
            if (-1 === I) {
                F.className = "root"
            } else {
                var M = "\u8f93\u5165\u540d\u79f0\u6216\u62fc\u97f3\u9996\u5b57\u6bcd\u67e5\u627e",D = document.createElement("div");
                D.className = "quick-find";
                var L = document.createElement("input");
                L.className = "text";
                if (11 < H.num) {
                    L.className += " short"
                }
                L.setAttribute("type", "text");
                L.setAttribute("value", M);
                D.appendChild(L);
                F.appendChild(D);
                f.on(L, "focus", function(P) {
                    if (M === L.value) {
                        L.value = ""
                    }
                });
                f.on(L, "blur", function(P) {
                    if ("" === L.value) {
                        L.value = M
                    }
                });
                var C = [];
                f.on(L, "keydown", function(P) {
                    if (13 === f.getCharCode(P)) {
                        f.stopEvent(P)
                    }
                });
                f.on(L, "keyup", function(P) {
                    if (null !== q) {
                        q.cancel()
                    }
                    var Q = L.value.toLowerCase().replace(/^[\s\t ]+/g, "");
                    q = b.later(250, this, function(W) {
                        while (0 !== C.length) {
                            var X = N.childNodes[1];
                            g.removeClass(X, "sticky");
                            var S = C.length + C.shift() + 1;
                            N.insertBefore(X, N.childNodes[S] || null)
                        }
                        if (N.childNodes.length > 6 && "undefined" !== typeof y[I]) {
                            N.scrollTop = g.getY(y[I].elmt) - u
                        }
                        if ("" !== Q) {
                            var U = document.createDocumentFragment(),T = (/[\u0391-\uFFE5]?/.test(Q));
                            var R = N.getElementsByTagName("span");
                            for (var V = R.length - 1; 0 <= V; V--) {
                                var X = R[V].parentNode;
                                if ((true === T && -1 !== R[V].firstChild.nodeValue.indexOf(Q)) || -1 !== R[V].getAttribute("data-spell").indexOf(Q)) {
                                    C.unshift(V);
                                    g.addClass(X, "sticky");
                                    U.insertBefore(X, U.firstChild || null)
                                }
                            }
                            if (0 !== U.childNodes.length) {
                                N.insertBefore(U, N.childNodes[1] || null);
                                N.scrollTop = 0
                            } else {
                                if (13 === W) {
                                    alert("\u65e0\u5339\u914d\u7c7b\u76ee")
                                }
                            }
                        }
                    }, [P.keyCode])
                }, this, true)
            }
            return F
        };
        //Dealwith
        var z = function(G, B) {
            if (true === B) {
                A.olCascadingList.appendChild(v(G["0"]))
            } else {
                e(A.olCascadingList);
                y.splice(0, y.length);
                o = 1;
                n = 0;
                g.setStyle(A.olCascadingList, "left", "0px");
                var H = document.createDocumentFragment();
                for (var L in G) {
                    if (false === j && L === r) {
                        H.appendChild(v(G[L], 0));
                        break
                    }
                    H.appendChild(v(G[L], L))
                }
                A.olCascadingList.appendChild(H);
                var J = y.length - 1;
                for (var E = 0; E <= J; E++) {
                    var F = y[E],M = F.elmt;
                    M.parentNode.scrollTop = g.getY(M) - u
                }
                if (0 <= J) {
                    p(F.sid);
                    var D = -1 !== Array.indexOf(A.valRestrictedCates, F.sid);
                    var I = 0;
                    if (0 === J && true === D) {
                        I = 2
                    } else {
                        if (0 === F.type && 0 !== F.leaf) {
                            if (1 === F.leaf) {
                                I = 1
                            } else {
                                I = 3
                            }
                        } else {
                            if (1 === F.type) {
                                I = 3
                            }
                        }
                    }
                    XT.IC.CateSetup.updateTriggers(I);
                    if (true === D) {
                        g.removeClass(A.divRestrictedTip, "transparent")
                    } else {
                        g.addClass(A.divRestrictedTip, "transparent")
                    }
                }
            }
            var C = A.olCascadingList.childNodes.length;
            if (4 < C) {
                var K = (C - 4) * A.valListWidth * -1 + A.valAdjustWidth;
                k(K);
                o = 1;
                n = C - 4;
                g.removeClass(A.linkPrev, "transparent");
                g.addClass(A.linkNext, "transparent")
            }
        };
        //RequestData
        var t = function(C, D, B) {
            var E = "sid=" + C + "&path=" + ((true === B) ? "next" : "all");
            if ("" !== D) {
                E += "&pv=" + D
            } //alert(E);
            if (null !== l && true === h.isCallInProgress(l)) {
                return s("\u6570\u636e\u6b63\u5728\u8bfb\u53d6\u4e2d")
            }
            g.removeClass(A.divLoading, "transparent");//alert(A.apiBranchUrl + ((-1 === A.apiBranchUrl.indexOf("?")) ? "?" : "&") + "_input_charset=utf-8") 
            l = h.asyncRequest("POST", A.apiBranchUrl + ((-1 === A.apiBranchUrl.indexOf("?")) ? "?" : "&") + "_input_charset=utf-8", {success:function(G) {
                g.addClass(A.divLoading, "transparent");
                if (-1 === G.status) {
                    return s("\u8bfb\u53d6\u8fde\u63a5\u8d85\u65f6\uff0c\u8bf7\u91cd\u8bd5\u3002")
                } else {
                    if (undefined !== G.responseText) {
                        try {
                            var F = b.JSON.parse(G.responseText)
                        } catch(H) {
                            return s("\u7c7b\u522b\u6570\u636e\u683c\u5f0f\u9519\u8bef\uff0c\u8bf7\u91cd\u8bd5\u3002")
                        }
                        if (0 === F.num) {
                            return false
                        } else {
                            z(F.data, B)
                        }
                    } else {
                        return s("\u7c7b\u76ee\u6570\u636e\u4e22\u5931\uff0c\u8bf7\u91cd\u8bd5\u3002")
                    }
                }
            },failure:function() {
                g.addClass(A.divLoading, "transparent");
                return s("\u63a5\u53e3\u8bbf\u95ee\u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002")
            },timeout:10000,cache:false}, E)
        };
        return{init:function(B) {
            A = XT.IC.CateSetup.getConfig();
            if ("undefined" === typeof A) {
                return false
            }
            XT.IC.CateSetup.updateTriggers();
            if (0 !== XT.IC.CateDesc.num) {
                w = XT.IC.CateDesc.data
            }
            if (1 === XT.IC.AlchlCates.allow) {
                j = true
            } else {
                r = A.valAlchlRoot
            }
            t(A.iptCateId.value, A.iptPropId.value, false);
            u = g.getY(A.olCascadingList) + 6 + 6 * 22;
            f.on(A.frmCateFilter, "submit", function(C) {
                f.stopEvent(C);
                XT.IC.CateSetup.submitForm(0)
            });
            f.on(A.linkPublish, "click", function(C) {
                f.stopEvent(C);
                XT.IC.CateSetup.submitForm(1)
            });
            f.on(A.linkPrev, "click", function(C) {
                f.stopEvent(C);
                if (0 === n || (null !== m && true === m.isAnimated())) {
                    return false
                }
                if (0 < o) {
                    o = -1
                }
                var D = A.valListWidth;
                if (-1 === o) {
                    D -= A.valAdjustWidth
                }
                k(D, true);
                o--;
                n--;
                if (0 === n) {
                    g.addClass(A.linkPrev, "transparent")
                }
                g.removeClass(A.linkNext, "transparent")
            });
            f.on(A.linkNext, "click", function(D) {
                f.stopEvent(D);
                var C = A.olCascadingList.childNodes.length - 4;
                if (C === n || (null !== m && true === m.isAnimated())) {
                    return false
                }
                if (0 > o) {
                    o = 1
                }
                var E = A.valListWidth * -1;
                if (1 === o) {
                    E += A.valAdjustWidth
                }
                k(E, true);
                o++;
                n++;
                g.removeClass(A.linkPrev, "transparent");
                if (C === n) {
                    g.addClass(A.linkNext, "transparent")
                }
            })
        },getPathCache:function() {
            return y
        },getBranch:function(B) {
            t(B, "", false)
        },reBranch:function(sid,pv){
            t(sid, pv, true);  
        }}
    }();

    XT.IC.CateSetup = function() {
        var i = {},k = 0,m = 1;
        var j = function(n) {
            alert(n);
            return false;
        };
        var l = function() {
            d.Get.script(i.apiStartupUrl, {onSuccess:function() { 
                if ("undefined" === typeof XT.IC.AlchlCates || "undefined" === typeof XT.IC.CateDesc || "undefined" === typeof XT.IC.OftenSelCates) {
                    return j("\u65e0\u6cd5\u5b8c\u6210\u521d\u59cb\u6570\u636e\u7684\u52a0\u8f7d");
                }
                if (i.frmCateSearch) {
                    XT.IC.SearchCate.init()
                }
                if (0 !== XT.IC.OftenSelCates.num) {
                    XT.IC.OftenSelected.init()
                }
                if (i.frmCateFilter) {
                    XT.IC.Cascading.init()
                }
            },onFailure:function() {alert(22)
                return j("\u63a5\u53e3\u8bbf\u95ee\u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002")
            },timeout:10000,autopurge:true,charset:document.charset || document.characterSet || "gb2312"})
        };
        return{init:function(n) {
            i = n || {};
            b.augmentObject(i, {btnCateSearch:$("J_BtnCateSearch"),iptCateSearch:$("J_IptCateSearch"),
                frmCateSearch:$("J_FrmCateSearch"),iptCateId:$("J_IptCateID"),iptPropId:$("J_IptPropID"),
                lstSearchResult:$("J_LstSearchResult"),spanResultTips:$("J_SpanResultTips"),linkCancel:$("J_LinkCancel"),
                selOftenSelected:$("J_SelOftenSelected"),frmCateFilter:$("J_FrmCateFilter"),olCascadingList:$("J_OlCascadingList"),
                linkPrev:$("J_LinkPrev"),linkNext:$("J_LinkNext"),olCatePath:$("J_OlCatePath"),spanPointer:$("J_SpanPointer"),
                divTooltip:$("J_DivTooltip"),emCateDesc:$("J_EmCateDesc"),btnPublish:$("J_BtnPublish"),linkPublish:$("J_LinkPublish"),
                apiStartupUrl:"./assets/js/testData/test.php",apiSearchUrl:"./assets/js/testData/search.php",
                apiBranchUrl:"./assets/js/testData/path.php",valAlchlRoot:"50008141",
                valRestrictedCates:["50012472"],valListWidth:225,valAdjustWidth:11});
            i.urlLinkRef = i.linkPublish.getAttribute("href");
            i.divResultTips = i.spanResultTips.parentNode;
            i.divSearchResult = i.lstSearchResult.parentNode.parentNode;
            i.divCascading = i.olCascadingList.parentNode.parentNode.parentNode;
            i.divExtraInfo = i.olCatePath.parentNode.parentNode.parentNode.parentNode;
            i.divCateDesc = i.emCateDesc.parentNode.parentNode;
            //divLoading
            var s = document.createElement("span");
            s.appendChild(document.createTextNode("\u52a0\u8f7d\u4e2d..."));
            var o = document.createElement("div");
            o.className = "loading-status";
            o.appendChild(s);
            document.body.appendChild(o);
            var u = function() {
                g.setXY(o, g.getXY(i.divCascading))
            };
            u();
            o.className += " transparent";
            i.divLoading = o;
            //divRestrictedTip
            var v = document.createElement("p");
            v.appendChild(document.createTextNode("\u4fdd\u5065\u98df\u54c1\u7c7b\u76ee\u8bf7\u5229\u7528\u5b9d\u8d1d\u6a21\u677f\u53d1\u5e03"));
            v.className = "tips";
            var r = document.createElement("span");
            r.className = "arrow";
            var q = document.createElement("div");
            q.className = "restriction msg";
            q.appendChild(v);
            q.appendChild(r);
            document.body.appendChild(q);
            var p = function() {
                g.setXY(q, [g.getX(i.linkPublish),g.getY(i.linkPublish) - 30])
            };
            p();
            q.className += " transparent";
            i.divRestrictedTip = q;
            i.divRestrictedTxt = v;
            var t = b.later(0, this, function() {
            });
            f.on(window, "resize", function() {
                t.cancel();
                t = b.later(500, this, function() {
                    u();
                    p()
                })
            });
            l()
        },getConfig:function() {
            return i
        },switchMode:function(o, n) {
            if (0 === o) {
                if (1 === m) {
                    m = 0;
                    if (true === n) {
                        return
                    }
                    this.updateTriggers();
                    g.addClass(i.divCascading, "hidden");
                    g.addClass(i.divExtraInfo, "hidden");
                    g.removeClass(i.divSearchResult, "hidden")
                }
            } else {
                if (0 === m) {
                    m = 1;
                    if (true === n) {
                        return
                    }
                    this.updateTriggers();
                    g.removeClass(i.divCascading, "hidden");
                    g.removeClass(i.divExtraInfo, "hidden");
                    g.addClass(i.divSearchResult, "hidden");
                    g.addClass(i.divResultTips, "hidden")
                }
            }
        },updateTriggers:function(n) {
            k = n || 0;
            i.btnPublish.disabled = true;
            g.addClass(i.btnPublish, "disabled");
            g.addClass(i.linkPublish, "disabled");
            if (k & 1) {
                i.btnPublish.disabled = false;
                g.removeClass(i.btnPublish, "disabled")
            }
            if (k & 2) {
                g.removeClass(i.linkPublish, "disabled")
            }
        },submitForm:function(p) {
            var p = p || 0;
            if (!((k & 1 && 0 === p) || (k & 2 && 1 === p))) {
                return false
            }
            if (0 === m) {
                var r = XT.IC.SearchCate.getSelCate();
                if ("undefined" === typeof r.elmt) {
                    return false
                } else {
                    if (0 === r.leaf) {
                        this.switchMode(1);
                        XT.IC.Cascading.getBranch(r.sid);
                        return false
                    } else {
                        var s = r.sid;
                        i.iptPropId.value = ""
                    }
                }
            } else {
                var t = XT.IC.Cascading.getPathCache();
                if (0 === t.length) {
                    return false
                }
                var o = [];
                for (var n = t.length - 1; 0 <= n; n--) {
                    var q = t[n];
                    if (1 === q.type) {
                        o.unshift(q.sid)
                    } else {
                        if (0 !== q.leaf) {
                            var s = q.sid;
                            break
                        }
                    }
                }
                i.iptPropId.value = o.join(";")
            }
            switch (p) {case 0:i.iptCateId.value = s;i.frmCateFilter.submit();break;case 1:window.location = i.urlLinkRef + ((-1 === i.urlLinkRef.indexOf("?")) ? "?cat_id=" : "&cat_id=") + s;break}
        }}
    }()
})();